<template>
	<view class="content">
		<!-- <u-navbar leftIcon="arrow-leftward" title="找合同-婚姻家庭" leftIconColor="#333" placeholder autoBack bgColor="#fff" :titleStyle="titleStyle"></u-navbar> -->
		<navbar title='法律讲堂'>
		</navbar>
		<u-sticky offset-top="0">
			<view class="souview">
				<view class="souitem">
					<image class="icon_sousuo" src="@/static/new/icon_sousuo.png"></image>
					<u-input placeholder="请输入视频关键词" :clearable="true" :border="false" v-model="name"></u-input>
					<view class="soubtn" @click="getsou">搜索</view>
				</view>
			</view>
		</u-sticky>
		<view class="fone plr">

			<view class="list">
				<!-- <view class="item" v-for="(item,index) in list" :key="index" @click="getDetail(item)">
					<image class="tubg" mode="" :src="item.img"></image>
					<view class="botview">
						<text class="biaoti txt">{{ item.name }}</text>
					</view>
				</view>
				<view class="nodata" v-if="list == ''">
					<u-empty text="暂无数据" mode="list" ></u-empty>
				</view> -->

				<!-- <view class="picture">
				<view class="itemtu"  v-for="(item,index) in list" :key="index">
					<image :src="item.img" mode='widthFix' bindtap="viewImage"></image>
				</view>
			</view> -->

			<custom-waterfalls-flow v-if="list" ref="waterfallsFlowRef" style="width: 100%;" imageKey="img" :value="list" :column="column" @wapperClick="getDetail" @imageClick="getDetail">
				<template v-slot:default="item">
					<view class="botview">
						<view class="biaoti">{{item.name}}</view>
					</view>
				</template>
			</custom-waterfalls-flow>
			</view>

			
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				titleStyle:{
					fontWeight: 'bold',
					fontSize: '36rpx',
					color: '#111111',
				},
				value:'',
				list: [],
				page: 1,
				limit: 10,
				last_page: 1,
				status: "loadmore",
				name:'',

				loadStatus: 'loadmore',
				flowList: [],
				nlist: [
					{
						price: 35,
						title: '北国风光，千里冰封，万里雪飘',
						shop: '李白杜甫白居易旗舰店',
						image: 'http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23327_s.jpg',
					},
					{
						price: 75,
						title: '望长城内外，惟余莽莽',
						shop: '李白杜甫白居易旗舰店',
						image: 'http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23325_s.jpg',
					},
					{
						price: 385,
						title: '大河上下，顿失滔滔',
						shop: '李白杜甫白居易旗舰店',
						image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
					},
					{
						price: 784,
						title: '欲与天公试比高',
						shop: '李白杜甫白居易旗舰店',
						image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/zzpic23369_s.jpg',
					},
					{
						price: 7891,
						title: '须晴日，看红装素裹，分外妖娆',
						shop: '李白杜甫白居易旗舰店',
						image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2130_s.jpg',
					},
					{
						price: 2341,
						shop: '李白杜甫白居易旗舰店',
						title: '江山如此多娇，引无数英雄竞折腰',
						image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23346_s.jpg',
					},
					{
						price: 661,
						shop: '李白杜甫白居易旗舰店',
						title: '惜秦皇汉武，略输文采',
						image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23344_s.jpg',
					},
					{
						price: 1654,
						title: '唐宗宋祖，稍逊风骚',
						shop: '李白杜甫白居易旗舰店',
						image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg',
					},
					{
						price: 1678,
						title: '一代天骄，成吉思汗',
						shop: '李白杜甫白居易旗舰店',
						image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg',
					},
					{
						price: 924,
						title: '只识弯弓射大雕',
						shop: '李白杜甫白居易旗舰店',
						image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg',
					},
					{
						price: 8243,
						title: '俱往矣，数风流人物，还看今朝',
						shop: '李白杜甫白居易旗舰店',
						image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg',
					},
				],
				data: {
                    list: [{ image: 'https://via.placeholder.com/200x500.png/ff0000', title: '我是标题1', desc: '描述描述描述描述描述描述描述描述1' }, 
                    { image: 'https://via.placeholder.com/200x200.png/2878ff', title: '我是标题2', desc: '描述描述描述描述描述描述描述描述2' }, 
                    { image: 'https://via.placeholder.com/200x100.png/FFB6C1', title: '我是标题3', desc: '描述描述描述描述描述描述描述描述3' }, 
                    { image: 'https://via.placeholder.com/200x300.png/9400D3', title: '我是标题4', desc: '描述描述描述描述描述描述描述描述4' }, 
                    { image: 'https://via.placeholder.com/100x240.png/B0E0E6', title: '我是标题5', desc: '描述描述描述描述描述描述描述描述5' }, 
                    { image: 'https://via.placeholder.com/140x280.png/7FFFAA', title: '我是标题6', desc: '描述描述描述描述描述描述描述描述6' }, 
                    { image: 'https://via.placeholder.com/40x60.png/EEE8AA', title: '我是标题7', desc: '描述描述描述描述描述描述描述描述7' }]
                },
                column: 2
			}
		},
		onLoad() {
			this.getList()
		},
		onShow() {
		},
		onReachBottom: function () {
			this.loadmore();
		},
		methods: {
			reset(){
				this.data.list = [{ image: 'https://via.placeholder.com/200x500.png/ff0000', title: '我是标题1', desc: '描述描述描述描述描述描述描述描述1' }]
				this.$refs.waterfallsFlowRef.refresh();
			},
			async getList(){//列表数据
				let res = await this.$u.api.lawhallindex({
					limit:this.limit,
				  	page:this.page,
					name:this.name
				});
				this.last_page = res.list.last_page;
				let list = res.list.list;
				this.list = this.page == 1 ? list : [...this.list, ...list];	
				// this.list = [...this.list, ...list]
				// let shuzu  = this.list
				if(this.page >= this.last_page){
				  this.status = 'nomore';
				}
				
			},
			loadmore() {
				let page = this.page;
				if (this.status == 'loadmore') {
					this.page++;
					this.getList();
				}
			},
			getDetail(item){
				console.log(item)
				this.navrouter("/pages/TPage/FaKeDetail?id="+item.id);
			},
			getsou(){
				this.getClear()
			},
			getClear(){
				this.list = []
				this.page = 1,
				this.status= "loadmore"
				this.getList()
			}
		}
	}
</script>
<style scoped lang="scss">
	.content {
		min-height: 100vh;
		background-color: #f5f5f5;

		.souview{
			background-color: #fff;
			padding: 20rpx 30rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			
			.souitem{
				height: 78rpx;
				background: #F5F5F5;
				border-radius: 39rpx;
				display: flex;
				align-items: center;
				flex-direction: row;
				padding: 0 23rpx;
				width: 100%;
				.icon_sousuo{
					width: 24rpx;
					height: 24rpx;
					margin-right: 15rpx;
				}
				.soubtn{
					margin-left: 20rpx;
					width: 100rpx;
					height: 50rpx;
					background: #3E65E5;
					border-radius: 25rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #FFFFFF;
				}
			}
		}
		.fone{
			margin-top: 40rpx;
			.flist{
				display: flex;
				flex-direction: row;
				flex-wrap: wrap;
				.fitem{
					width: 25%;
					display: flex;
					flex-direction:column;
					align-items: center;
					justify-content: center;
					margin-bottom: 44rpx;
					text{
						display: inline-block;
						margin-top: 13rpx;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #666666;
					}
					.ficon{
						width: 80rpx;
						height: 80rpx;
					}
				}
			}
			.shenhe{
				height: 60rpx;
				background: #F3F6F9;
				border-radius: 10px;
				padding: 0 30rpx;
				display: flex;
				flex-direction: row;
				align-items: center;
				.shenitem{
					width: 33.33%;
					display: flex;
					flex-direction: row;
					align-items: center;
					border-right: 1rpx solid rgba(62,101,229,0.3);
					justify-content: center;
					.shenone{
						margin-right: 3rpx;
						width: 33rpx;
						height: 33rpx;
					}
					.shentit{
						font-family: PingFang SC;
						font-weight: 400;
						font-size: 24rpx;
						color: #3C66DE;

					}
				}
				.shenitem:last-child{
					border-right: none;
				}
			}

			.leiview{
				width: 100%;
				.leiscview{
					white-space: nowrap;
					// overflow-x: auto;
					.leiitem{
						display: inline-block;
						padding: 20rpx 40rpx;
						background: #EEEEEE;
						border-radius: 16rpx;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #666666;
						margin-right: 20rpx;
					}
					.lactive{
						background: #3E65E5;
						color: #fff;

					}
				}
				
			}
		}
		.list{
			display: flex;
			flex-direction: row;
			flex-wrap: wrap;
			margin-top: 30rpx;

			.item{
				width: 48.5%;
				display: inline-block;
				flex-direction: column;
				margin-bottom: 20rpx;
				background-color: #fff;
				border-radius: 16rpx;
				// border: 1rpx solid #eee;
				// box-shadow: 0px 3rpx 9rpx 0px rgba(109,109,109,0.1);
				
				.tubg{
					width: 100%;
					// height: 400rpx;
					margin-bottom: 20rpx;
				}
				
				.pjia{
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 26rpx;
					color: #E53E3E;
					display: block;
					margin-top: 20rpx;
					margin-left: auto;
					.pnum{
						font-size: 36rpx;
					}
				}
				.xinview{
					margin: 30rpx 0 0rpx auto;
					display: flex;
					flex-direction: row;
					align-items: center;
					.xins{
						width: 36rpx;
						height: 36rpx;
						margin-right: 5rpx;
					}
					text{
						font-family: PingFang SC;
						font-weight: 400;
						font-size: 24rpx;
						color: #999999;
					}
				}
			}
			.item:nth-child(even){
				margin-left: auto;
			}
		}
		.txt {
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
		}
		.plr{
			padding: 0 30rpx;
		}
		.ftit{
			display: block;
			margin-bottom: 30rpx;
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: #111111;
		}



	}
	.picture{
		column-gap: 5rpx;
		column-count: 2;
		// padding: 10rpx 10rpx 10rpx 15rpx;
		width: 100%;
	}
	
	.itemtu{
		width: 50%;  /*占每列的宽的900%*/
		break-inside: avoid;
	}
	
	.item image{
		width: 100%;
		border-radius: 5rpx;
	}

	.botview{
		display: flex;
		flex-direction: column;
		padding: 20rpx ;
	}
	.biaoti{
		display: inline-block;
		font-family: PingFang SC;
		font-weight: bold;
		font-size: 26rpx;
		color: #333333;
	}
</style>